|
Control statements control the flow of the program. They enable the computer to know that whether to execute certain set of statements or not under a given condition

| Syntax | Input | Output |
|---|---|---|
#include<stdio.h>
main()
{
switch (choice)
{
case 1:
_____;
_____;
case 2:
_____;
_____;
case 3:
_____;
_____;
}
getch();
}
|
#include<stdio.h>
main()
{
int a;
clrscr();
a=4;
switch (a)
{
case 1:
printf("Monday");
case 2:
printf("\nTuesday");
case 3:
printf("\nWednesday");
case 4:
printf("\nThursday");
case 5:
printf("\nFriday");
case 6:
printf("\nSaturday");
case 7:
printf("\nSunday");
}
getch();
}
|
|
| Syntax | Input | Output |
|---|---|---|
#include<stdio.h>
main()
{
int a;
for(initializing part, conditional part, inc/dec)
{
________;
________;
________;
}
getch();
}
|
#include<stdio.h>
main()
{
int i;
for(i=1;i<=30;i++)
{
printf("\n%d",i);
}
getch();
}
|
|
| Syntax | Input | Output |
|---|---|---|
#include<stdio.h>
main()
{
int a;
a=value;
while(condition)
{
________;
________;
Ind/dec;
}
getch();
}
|
#include<stdio.h>
main()
{
int i;
i=0;
while (i<=50)
{
printf ("%d\n",i);
i=i+5;
}
getch();
}
|
|
| Syntax | Input | Output |
|---|---|---|
#include<stdio.h>
main()
{
int i;
i=value;
do
{
________;
________;
inc/dec;
}
while (conditional part);
getch();
}
|
#include<stdio.h>
main()
{
int i;
clrscr();
i=0;
do
{
printf ("%d\n",i);
i=i+9;
}
while(i<100);
getch();
}
|
|